import { createStore, applyMiddleware ,compose } from 'redux';
import createRootReducer from './reducers';
import thunk from 'redux-thunk';

export function getStore() {
    const store = createStore(
        createRootReducer(), // root reducer with router state
        compose(
            applyMiddleware(
                thunk
            )
        )
    )
    return store;
}

export function getClientStore() {
    const defaultStore = window.context.state;
    const store = createStore(
        createRootReducer(), // root reducer with router state
        defaultStore,
        compose(
            applyMiddleware(
                thunk
            )
        )
    );
    return store;
}
